from sklearn.svm import SVC
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler

quit = pd.read_csv("D:\\新建文件夹\\Python实验报告\\quit_job.csv", encoding='gbk')
quit_data = quit.iloc[:, :-1]
quit_target = quit.iloc[:, -1]
quit_data_train, quit_data_test, quit_target_train, quit_target_test = train_test_split(quit_data, quit_target, test_size=0.2, random_state=66)
stdScale = StandardScaler().fit(quit_data_train)
qtrainScale = stdScale.transform(quit_data_train)
qtestScale = stdScale.transform(quit_data_test)
svm = SVC().fit(qtrainScale, quit_target_train)
qt_pred = svm.predict(qtestScale)
print("测试集前20个结果为：\n", quit_target_test.values[0:20])
print("预测测试集前20个结果为：\n", qt_pred[0:20])






